** ---------------- Table 8: Investment decomposition: Fair value of investments
use "$data_path/database_bdc_level_synthetic.dta", clear
 
** --------------------------------- Panel (a) Fair value of investments by type
reghdfe fair_value_equity_ln2 ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_a

reghdfe fair_value_equity_ln2 ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_b

reghdfe fair_value_debt_ln2 ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_c

reghdfe fair_value_debt_ln2 ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_d

reghdfe fair_value_sub_debt_ln2 ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_e

reghdfe fair_value_sub_debt_ln2 ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_f

reghdfe fair_value_senior_debt_ln2 ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) noomit
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_g

reghdfe fair_value_senior_debt_ln2 ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_k

esttab reg_a reg_b reg_c reg_d reg_e reg_f reg_g reg_k ///
using "${tables_path}/table8a.tex" ///
,cells(b(star  fmt(2)) se(par  fmt(2))) stat(bdc_fe time_fe r2 N, fmt(%~15s %~15s %9.2g %9.0g ) layout(\mc{@} \mc{@} @ \mc{@}) labels("BDC FE" "Time FE" "\$R^{2}\$" "\textit{N}")) ///
style(tex) starlevels(^{*} 0.10  ^{**} 0.05 ^{***} 0.01)  nomtitles mgroups("ln(Equity Inv.)" "ln(Debt Inv.)" "ln(Sub. Debt Inv.)" "ln(Senior Debt Inv.)", pattern(1 0 1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) nonumbers collabels(none) ///
coeflabels(ind_post "Post" ind_treated_bdc "Treated" interaction "Post \$\times\$ Treated" lag_debt_to_assets_ratio "Debt/Assets\$_{t-1}\$" lag_assets_total_ln "ln(Assets\$_{t-1}\$)" lag_int_inc_net_avg_assets "Net Int. Inc./Assets\$_{t-1}\$" ) ///
replace substitute(\_ _) drop(_cons) noomit alignment(D{.}{.}{-1}) posthead(%) tex ///
nolines prefoot(\midrule) postfoot(\bottomrule \end{tabular} })
 
 
** -------------------------------------------------- Panel (b) Portfolio shares
reghdfe fair_value_equity_pct ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "No"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_a

reghdfe fair_value_equity_pct ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "Yes"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_b

reghdfe fair_value_debt_pct ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "No"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_c

reghdfe fair_value_debt_pct ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "Yes"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_d

reghdfe fair_value_sub_debt_pct ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "No"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_e

reghdfe fair_value_sub_debt_pct ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "Yes"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_f

reghdfe fair_value_senior_debt_pct ind_treated_bdc ind_post interaction, absorb(bdc_ticker_num filingdateqtr) noomit
estadd local controls "No"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_g

reghdfe fair_value_senior_debt_pct ind_treated_bdc ind_post interaction lag_assets_total_ln lag_debt_to_assets_ratio lag_int_inc_net_avg_assets, absorb(bdc_ticker_num filingdateqtr) 
estadd local controls "Yes"
estadd local bdc_fe "Yes"
estadd local time_fe "Yes"
estimates store reg_k

esttab reg_a reg_b reg_c reg_d reg_e reg_f reg_g reg_k ///
using "${tables_path}/table8b.tex" ///
,cells(b(star  fmt(2)) se(par  fmt(2))) stat(bdc_fe time_fe r2 N, fmt(%~15s %~15s %9.2g %9.0g ) layout(\mc{@} \mc{@} @ \mc{@}) labels("BDC FE" "Time FE" "\$R^{2}\$" "\textit{N}")) ///
style(tex) starlevels(^{*} 0.10  ^{**} 0.05 ^{***} 0.01)  nomtitles mgroups("\% of Equity Inv" "\% of Debt Inv." "\% of Sub. Debt Inv." "\% of Senior Debt Inv.", pattern(1 0 1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) nonumbers collabels(none) ///
coeflabels(ind_post "Post" ind_treated_bdc "Treated" interaction "Post \$\times\$ Treated" lag_debt_to_assets_ratio "Debt/Assets\$_{t-1}\$" lag_assets_total_ln "ln(Assets\$_{t-1}\$)" lag_int_inc_net_avg_assets "Net Int. Inc./Assets\$_{t-1}\$" ) ///
replace substitute(\_ _) drop(_cons) noomit alignment(D{.}{.}{-1}) posthead(%) tex ///
nolines prefoot(\midrule) postfoot(\bottomrule \end{tabular} })


